﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Content;

namespace BeatEmUp.Items.Weapons
{
    static class CompareWeapons
    {
        static bool isVisible = false;
        static Weapon playerWeapon;
        static Weapon pickUpWeapon;
        static Rectangle position;
        static Texture2D image;
        public static SpriteFont textFont;
        public static SpriteFont compareFont;

        public static void LoadContent(ContentManager content)
        {
            image = content.Load<Texture2D>("./Sprites/Misc/CompareWindow");
            compareFont = content.Load<SpriteFont>("./Fonts/Compare");
            textFont = content.Load<SpriteFont>("./Fonts/HPStatus");
        }

        public static void Draw(SpriteBatch sb)
        {
            if (isVisible)
            {
                sb.Draw(image, GameManager.customResolution.ScaleRectangle(position), Color.White);
                sb.DrawString(compareFont, "Player weapon:\r\n" + playerWeapon.GetWeaponDescription(), GameManager.customResolution.ScaleToVector(new Vector2(position.X + 10, position.Y + 5)), Color.Black, 0, Vector2.Zero, GameManager.customResolution.ScaleRatio(), SpriteEffects.None, 0.0f);
                sb.DrawString(compareFont, "Weapon from enemy:\r\n" + pickUpWeapon.GetDescriptionWithComparision(playerWeapon), GameManager.customResolution.ScaleToVector(new Vector2(position.X + image.Width/2+10, position.Y + 5)), Color.Black, 0, Vector2.Zero, GameManager.customResolution.ScaleRatio(), SpriteEffects.None, 0.0f);
            }
        }

        public static void SetData(Vector2 positionVector,Weapon playerWeapon,Weapon pickUpWeapon)
        {
            CompareWeapons.playerWeapon = playerWeapon;
            CompareWeapons.pickUpWeapon = pickUpWeapon;
            position = new Rectangle((int)positionVector.X-image.Width/2,(int)positionVector.Y-image.Height,image.Width,image.Height);
            if (position.X < 0)
                position.X = 0;
            if (position.X + image.Width > 1024)
                position.X = 1024- image.Width;
            isVisible = true;
        }

        public static bool IsVisible
        {
            set
            {isVisible = value;}
            get
            { return isVisible; }
        }
    }
}
